package kr.hkit.PowerJava.chapter17;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.GridLayout;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.JPasswordField;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class MyFrame extends JFrame implements ActionListener {
	private JTextField TfId;
	private JPasswordField pfpassword;
	private JTextField FtfDate;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					MyFrame frame = new MyFrame();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public MyFrame() {
		initialize();
	}
	private void initialize() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		JPanel contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		JPanel panelTop = new JPanel();
		contentPane.add(panelTop, BorderLayout.NORTH);
		panelTop.setLayout(new GridLayout(0, 2, 0, 0));
		
		JLabel lblNewLabel = new JLabel("ID");
		lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
		panelTop.add(lblNewLabel);
		
		TfId = new JTextField();
		TfId.addActionListener(this);
		TfId.setHorizontalAlignment(SwingConstants.CENTER);
		panelTop.add(TfId);
		TfId.setColumns(10);
		
		JLabel lblNewLabel_1 = new JLabel("PASSWORD");
		lblNewLabel_1.setHorizontalAlignment(SwingConstants.CENTER);
		panelTop.add(lblNewLabel_1);
		
		pfpassword = new JPasswordField();
		pfpassword.addActionListener(this);
		pfpassword.setColumns(30);
		panelTop.add(pfpassword);
		
		JLabel lblNewLabel_2 = new JLabel("DATE");
		lblNewLabel_2.setHorizontalAlignment(SwingConstants.CENTER);
		panelTop.add(lblNewLabel_2);
		
		FtfDate = new JTextField();
		FtfDate.addActionListener(this);
		panelTop.add(FtfDate);
		FtfDate.setColumns(10);
		
		JPanel panelCenter = new JPanel();
		contentPane.add(panelCenter, BorderLayout.CENTER);
		
		JTextArea textArea = new JTextArea(10, 30);
		
		JScrollPane scrollPane = new JScrollPane();
		panelCenter.add(scrollPane);
		
		
		
	}

	public void actionPerformed(ActionEvent e) {
		if (e.getSource() == TfId) {
			actionPerformedTfd(e);
		}
		if (e.getSource() == pfpassword) {
			actionPerformedPfpassword(e);
		}
		if (e.getSource() == FtfDate) {
			actionPerformedFtfDate(e);
		}
	}
	protected void actionPerformedFtfDate(ActionEvent e) {
	}
	protected void actionPerformedPfpassword(ActionEvent e) {
	}
	protected void actionPerformedTfd(ActionEvent e) {
	}
}
